﻿<%@ Page Title="感官(主观)评分" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="SenseScore.aspx.cs" Inherits="StoragePeriod.Web.FoodTesting.SenseScore" %>

<asp:Content ID="HeaderContent" ContentPlaceHolderID="HeadContent" runat="server">
    <style type="text/css">
    .layout{background:url(../images/images_25.jpg) no-repeat; }
    .Right_title{width:764px; height:32px; background-position:0px 0px;}
    .Right_center{height:450px;}
    </style>
    <script src="../Scripts/My97DatePicker/WdatePicker.js" type="text/javascript"></script>
    <script src="../Scripts/highcharts/highcharts.js" type="text/javascript"></script>
    <script src="../Scripts/highcharts/modules/exporting.js" type="text/javascript"></script>
    <script src="../Scripts/sp_FoodTesting.js" type="text/javascript"></script>
    <%--<script src="../Scripts/jquery-1.4.1.js" type="text/javascript"></script>--%>
    <script type="text/javascript">
        $(document).ready(function () {
            $(".Right_title li").click(function () {
                $(".Right_title li").css("color", "#fff");
                $(this).css("color", "#f90");
                $(".center_Main").addClass("displaynone").removeClass("displayblock");
                $("#center_" + $(this).attr("showid")).removeClass("displaynone").addClass("displayblock");
                $("#MainContent_HidPageId").val($(this).attr("showid"));

                $("#HidIsMulti").val($(this).attr("showid"));
                TreeRadioOrMulti();
            });

            $("input[type='radio']").live("click", function () {
                $(".radio_page").addClass("displaynone").removeClass("displayblock");
                $("#radio_page_" + $(this).val()).removeClass("displaynone").addClass("displayblock");
                $("#MainContent_HidShowId").val($(this).val());
            });
            $(".nav_menu li[SubmenuId='02']").trigger("mouseover");

            $("#HidIsMulti").val("0");
            TreeRadioOrMulti();

            //
            $("#ScoreData input").live("change", function () {
                SetRawSumScore();
            });
        });

        function GetTxtValue() {
            if (!IsVerification())
                return false;
            var strValue = "";
            $("#ScoreData input").each(function () {
                strValue += ($(this).val() == "" ? "0" : $(this).val()) + "-" + $(this).attr("grid") + ",";
            });
            $("#MainContent_HidScoreData").val(strValue);
            return true;
        }

        function SetTxtValue() {
            var strValue = $("#MainContent_HidScoreData").val();
            if (strValue != "") {
                var s = strValue.split(',');
                for (var i = 0; i < s.length; i++) {
                    $("#ScoreData input[grid='" + s[i].split('-')[1] + "']").val(s[i].split('-')[0]);
                }
            }
            else {
                alert("不存在该评分!");
            }
        }

        function IsVerification() {
            var a = /^(\d{1,4})(-|\/)(\d{1,2})\2(\d{1,2})/
            if (!a.test($("#MainContent_txt_date").val())) {
                alert("日期格式不正确!")
                return false;
            }
            else if ($("#MainContent_HidRawID").val() == "") {
                alert("请选择原料!")
                return false;
            }
            else {
                return true;
            }
        }

        function IsVerificationFX() {
            var a = /^(\d{1,4})(-|\/)(\d{1,2})\2(\d{1,2})/
            if (!a.test($("#MainContent_txt_DateStart").val())) {
                alert("日期格式不正确!")
                return false;
            }
            else if (!a.test($("#MainContent_txt_DateEnd").val())) {
                alert("日期格式不正确!")
                return false;
            }
            else if ($("#MainContent_HidRawListId").val() == "") {
                alert("请选择原料!")
                return false;
            }
            else {
                return true;
            }
        }

        function SetShowPage() {
            $(".Right_title li").css("color", "#fff");
            $(".Right_title li[showid='1']").css("color", "#f90");
            $(".center_Main").addClass("displaynone").removeClass("displayblock");
            $("#center_1").removeClass("displaynone").addClass("displayblock");
            $("input[type='radio'][value='" + $("#MainContent_HidShowId").val() + "']").trigger("click");
        }

        function loadReport() {
            var startime = $("#MainContent_txt_DateStart").val();
            var endtime = $("#MainContent_txt_DateEnd").val();
            var rawidlist = $("#MainContent_HidRawListId").val();
            var rawlistname = $("#MainContent_lab_RawListName").text();
            sp.ajax.call("Report", { FunType: "SenseScore", StartTime: startime, EndTime: endtime, RawIDList: rawidlist, RawListName: rawlistname },
            function (res) {
                DataBangding(res.Data.XName, res.Data.YData);
            }, null, true)
        }

        //设置显示总分数
        function SetRawSumScore() {
            if ($("#MainContent_HidRawID").val() != "") {
                var strValue = 0;
                $("#ScoreData input").each(function () {
                    strValue += parseInt($(this).val() == "" ? "0" : $(this).val());
                });
                $("#SpanRawSumScore").text(strValue);
            }
            else {
                $("#SpanRawSumScore").text("");
            }
        }

    </script>

</asp:Content>



<asp:Content ID="BodyContentRight" ContentPlaceHolderID="MainContent" runat="server">

<div class="Right_title">
    <ul>
        <li id="Right_title_li_0" showid="0">感官评分</li>
        <li showid="1">评分结果分析</li>
    </ul>
</div>
<div class="Right_center">
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
    <asp:HiddenField ID="HidScoreData" runat="server" Value="" />
    <asp:HiddenField ID="HidRawID" runat="server" Value="" />
    <div id="center_0" class="center_Main displayblock">
        <div class="center_btnlist">
            <ul>
               <li class="width200" style="width:210px;">食品原料:<asp:Label ID="lab_RawName" runat="server" Text=""></asp:Label>&nbsp;&nbsp;&nbsp;&nbsp;总分:<span style="color:Red;" id="SpanRawSumScore"></span></li>
               <li>测定日期：</li>
               <li><asp:TextBox ID="txt_date" runat="server" CssClass="input" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd',maxDate:'%y-%M-%d'})"></asp:TextBox></li> 
               <li><input type="button" value="" class="btn_date" onclick="WdatePicker({dateFmt:'yyyy-MM-dd',maxDate:'%y-%M-%d',el:'MainContent_txt_date'})" /></li>
               <li><asp:Button ID="Btn_Search" runat="server" Text="查询" CssClass="btn_0" OnClientClick="return IsVerification();"
                       onclick="Btn_Search_Click" /></li>
               <li><asp:Button ID="Btn_Save" runat="server" Text="保存" CssClass="btn_0" OnClientClick="return GetTxtValue();"  onclick="Btn_Save_Click" /></li>
               <li><asp:button ID="Btn_Del" runat="server" Text="删除" CssClass="btn_0" OnClientClick="return IsVerification();"
                       onclick="Btn_Del_Click" /></li>
               <li><asp:Button ID="Btn_Export" runat="server" Text="导出Excel" CssClass="btn_1" OnClientClick="return IsVerification();"
                       onclick="Btn_Export_Click" /></li>
            </ul>
        </div>
        <div class="center_table" id="ScoreData">
            <table cellpadding="0" cellspacing="0" width="100%">
                <thead>
                    <tr>
                        <td width="60px;">评分</td>
                        <td>项目</td>
                        <td>评分标准</td>
                        <td>参考值</td>
                    </tr>
                </thead>
                <tbody>
                    <%
                        if (this.Data_Grading != null && this.Data_Grading.Count > 0)
                        {
                            for (int i = 0; i < this.Data_Grading.Count; i++)
                            {
                                this.Get_GradingInfo(this.Data_Grading[i].id);
                                if (this.Data_GradingInfo != null && this.Data_GradingInfo.Count > 0)
                                {
                                    int count = this.Data_GradingInfo.Count;
                                    for (int j = 0; j < this.Data_GradingInfo.Count; j++)
                                    { 
                                        %>
                                        
                                        <tr >
                                            <%
                                        if (j == 0)
                                        { 
                                                    %>
                                                        <td rowspan="<%=count %>">
                                                         <input type="text" grid="<%=this.Data_Grading[i].id %>" value="" class="width50 textcenter" />
                                                         </td>
                                                        <td rowspan="<%=count %>"><%=this.Data_Grading[i].GradingName%></td>
                                                    <%
                                        }
                                             %>
                                            <td><%=this.Data_GradingInfo[j].GradingTitle%></td>
                                            <td><%=this.Data_GradingInfo[j].ScoresRange%></td>
                                        </tr>
                                        <%
                                    }
                                }
                            }
                        }
                        else
                        { 
                            %>
                            <tr>
            <td rowspan="5">
                <input class="width50 textcenter" type="text" value="" grid="1">
            </td>
            <td rowspan="5">
                色泽
            </td>
            <td>
                蔬菜完全是本色，没有异常
            </td>
            <td>
                10-9
            </td>
        </tr>
        <tr>
            <td>
                蔬菜颜色开始微现变化，小于20%，光泽较鲜亮
            </td>
            <td>
                8-7
            </td>
        </tr>
        <tr>
            <td>
                蔬菜局部颜色变化介于30%到50%之间，光泽暗淡
            </td>
            <td>
                6-5
            </td>
        </tr>
        <tr>
            <td>
                变化大于50%，光泽很差，基本不能接受
            </td>
            <td>
                4-3
            </td>
        </tr>
        <tr>
            <td>
                完全变色，颜色发黑暗淡
            </td>
            <td>
                2-1
            </td>
        </tr>
        <tr>
            <td rowspan="4">
                <input class="width50 textcenter" type="text" value="" grid="2">
            </td>
            <td rowspan="4">
                气味
            </td>
            <td>
                蔬菜具有本身特有的清香味，无异常气味
            </td>
            <td>
                10-9
            </td>
        </tr>
        <tr>
            <td>
                蔬菜特有气味变淡，但无异常气味
            </td>
            <td>
                8-6
            </td>
        </tr>
        <tr>
            <td>
                蔬菜无清香气味
            </td>
            <td>
                5-3
            </td>
        </tr>
        <tr>
            <td>
                蔬菜有不和谐的异常气味
            </td>
            <td>
                2-0
            </td>
        </tr>
        <tr>
            <td rowspan="5">
                <input class="width50 textcenter" type="text" value="" grid="3">
            </td>
            <td rowspan="5">
                腐烂度
            </td>
            <td>
                蔬菜新鲜完整，无腐烂
            </td>
            <td>
                10
            </td>
        </tr>
        <tr>
            <td>
                蔬菜基本保持完好，微现腐烂症状
            </td>
            <td>
                9-8
            </td>
        </tr>
        <tr>
            <td>
                局部出现腐烂，小于10%
            </td>
            <td>
                7-6
            </td>
        </tr>
        <tr>
            <td>
                蔬菜开始有较多腐烂，腐烂率在10%-20%
            </td>
            <td>
                5-4
            </td>
        </tr>
        <tr>
            <td>
                腐烂率在30%以上，基本不能食用
            </td>
            <td>
                3-0
            </td>
        </tr>
        <tr>
            <td rowspan="4">
                <input class="width50 textcenter" type="text" value="" grid="4">
            </td>
            <td rowspan="4">
                出斑率
            </td>
            <td>
                花球成斑率小于10%
            </td>
            <td>
                10-9
            </td>
        </tr>
        <tr>
            <td>
                成斑率在20%-40%
            </td>
            <td>
                8-6
            </td>
        </tr>
        <tr>
            <td>
                成斑率在50%-30%
            </td>
            <td>
                5-3
            </td>
        </tr>
        <tr>
            <td>
                成斑率大于30%
            </td>
            <td>
                2-1
            </td>
        </tr>
        <tr>
            <td rowspan="3">
                <input class="width50 textcenter" type="text" value="" grid="5">
            </td>
            <td rowspan="3">
                机械损伤
            </td>
            <td>
                机体完好，没有任何物理损伤
            </td>
            <td>
                10-8
            </td>
        </tr>
        <tr>
            <td>
                有25%的损伤
            </td>
            <td>
                8-6
            </td>
        </tr>
        <tr>
            <td>
                有50%的损伤
            </td>
            <td>
                6-4
            </td>
        </tr>
        <tr>
            <td rowspan="3">
                <input class="width50 textcenter" type="text" value="" grid="6">
            </td>
            <td rowspan="3">
                冷害
            </td>
            <td>
                蔬菜任何冷害痕迹
            </td>
            <td>
                10-8
            </td>
        </tr>
        <tr>
            <td>
                25%的冷害面积
            </td>
            <td>
                8-6
            </td>
        </tr>
        <tr>
            <td>
                50%的冷害面积
            </td>
            <td>
                6-4
            </td>
        </tr>
        <tr>
            <td rowspan="4">
                <input class="width50 textcenter" type="text" value="" grid="7">
            </td>
            <td rowspan="4">
                硬度（客观）
            </td>
            <td>
                蔬菜硬挺、脆实、新鲜，手感结实
            </td>
            <td>
                10-8
            </td>
        </tr>
        <tr>
            <td>
                蔬菜变柔软，弯曲角度小于30°
            </td>
            <td>
                7-6
            </td>
        </tr>
        <tr>
            <td>
                蔬菜失去原有硬实和手感，开始出现塌陷症状，到商业临界
            </td>
            <td>
                6-5
            </td>
        </tr>
        <tr>
            <td>
                蔬菜变柔软，手感柔软，甚至流汁
            </td>
            <td>
                4-0
            </td>
        </tr>
        <tr>
            <td rowspan="5">
                <input class="width50 textcenter" type="text" value="" grid="8">
            </td>
            <td rowspan="5">
                萎蔫
            </td>
            <td>
                蔬菜大部分部位变色或出现大量斑点
            </td>
            <td>
                2-0
            </td>
        </tr>
        <tr>
            <td>
                表皮形态较好，微现皱缩症状
            </td>
            <td>
                9-8
            </td>
        </tr>
        <tr>
            <td>
                表皮皱缩，叶片翻卷，花球松散，皱缩率小于20%
            </td>
            <td>
                7-6
            </td>
        </tr>
        <tr>
            <td>
                皱缩率40%左右，表皮出现干化症状
            </td>
            <td>
                5-4
            </td>
        </tr>
        <tr>
            <td>
                蔬菜失水皱缩严重，大于50%
            </td>
            <td>
                3-0
            </td>
        </tr>
        <tr>
            <td rowspan="5">
                <input class="width50 textcenter" type="text" value="" grid="9">
            </td>
            <td rowspan="5">
                综合
            </td>
            <td>
                完整新鲜，清香
            </td>
            <td>
                10
            </td>
        </tr>
        <tr>
            <td>
                微现皱缩，色泽较好，清香
            </td>
            <td>
                9-8
            </td>
        </tr>
        <tr>
            <td>
                变色程度小于10%，微现腐烂，临近商业价值
            </td>
            <td>
                7-5
            </td>
        </tr>
        <tr>
            <td>
                表皮皱缩严重，开始腐烂，到了能吃的最低限
            </td>
            <td>
                4-3
            </td>
        </tr>
        <tr>
            <td>
                基本不能食用
            </td>
            <td>
                2-0
            </td>
        </tr>
                            
                            <%
                        }
                     %>
                </tbody>
            </table>
        </div>
    </div>
        </ContentTemplate>
    </asp:UpdatePanel>

    <div id="center_1" class="center_Main displaynone">
<asp:UpdatePanel ID="UpdatePanel2" runat="server">
    <ContentTemplate>
        <asp:HiddenField ID="HidShowId" runat="server" Value="0" />
        <asp:HiddenField ID="HidRawListId" runat="server" Value="" />
        <asp:HiddenField ID="HidPageId" runat="server" Value="0" />
        <div class="center_btnlist">
                <ul>
                   <li><input type="radio" value="0" name="radio_page_0" checked="checked" class="radiocss" />数据列表</li>
                   <li class="width200"><input type="radio"  value="1" name="radio_page_0" class="radiocss" />曲线分析</li>
                   <li>测定日期：</li>
                   <li><asp:TextBox ID="txt_DateStart" runat="server" CssClass="input" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd',maxDate:'%y-%M-%d'})" ></asp:TextBox></li> 
                   <li><input type="button" value="" class="btn_date" onclick="WdatePicker({dateFmt:'yyyy-MM-dd',maxDate:'%y-%M-%d',el:'MainContent_txt_DateStart'})" /></li>
                   <li>至</li>
                   <li><asp:TextBox ID="txt_DateEnd" runat="server" CssClass="input" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd',maxDate:'%y-%M-%d'})" ></asp:TextBox></li> 
                   <li><input type="button" value="" class="btn_date" onclick="WdatePicker({dateFmt:'yyyy-MM-dd',maxDate:'%y-%M-%d',el:'MainContent_txt_DateEnd'})" /></li>
                   <li><asp:Button ID="Btn_SearchFX" runat="server" Text="查询" OnClientClick="return IsVerificationFX();" CssClass="btn_0" OnClick="Btn_SearchFX_Click" /></li>
                </ul>
            </div>
        <div class="center_table displayblock radio_page" id="radio_page_0">
            <table cellpadding="0" cellspacing="0" width="100%">
                <thead>
                    <tr>
                        <td width="60px;">已选原料</td>
                        <%if (this.strDateList != null && this.strDateList.Count > 0) {
                              for (int i = 0; i < this.strDateList.Count; i++)
                              { 
                              %>
                                <td><%=this.strDateList[i].StrTime%></td>
                              <%
                              }
                          } %>
                    </tr>
                </thead>
                <tbody>
                    <%if (this.Assdatalist != null && this.Assdatalist.Count > 0) {
                          for (int i = 0; i < this.Assdatalist.Count; i++)
                          { 
                              %>
                                <tr>
                                    <td><%=this.Assdatalist[i][0].RawName%></td>
                                    <%if (this.Assdatalist[i][0].IsSelectRaw == 0)
                                      {
                                          for (int j = 0; j < this.Assdatalist[i].Count; j++)
                                          { 
                                      %>
                                        <td><%=this.Assdatalist[i][j].AssayScore%></td>
                                      <%
                                        }
                                      } %>
                                </tr>
                              <%
                          }
                      }
                      %>
                </tbody>
            </table>
        </div>
        
        <div class="center_table displaynone radio_page" id="radio_page_1">
            <table cellpadding="0" cellspacing="0" width="100%">
                <thead>
                    <tr>
                        <td class="textleft">已选原料:<asp:Label ID="lab_RawListName" runat="server"></asp:Label> </td>
                    </tr>
                </thead>
                <tbody>
                    <tr >
                        <td>
                            <div class="Curve">
                                <div id="container" style="min-width: 750px; height: 330px; margin: 0 auto">
                                    
                                </div>
                            </div>
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
        </ContentTemplate>
    </asp:UpdatePanel>
    </div>
</div>
<div class="Right_foot">
    <img src="../images/images_29.jpg" width="764" height="8"/>
</div>

</asp:Content>
